package main

import (
	"context"
	"fmt"
	"io"
	"net/http"
	"os"

	"github.com/zeromicro/go-zero/rest/httpc"
)

type Request struct {
	// Node          string `path:"node,optional"`
	// ID            int    `form:"id,optional"`
	ContentType   string `header:"Content-Type"`
	Authorization string `header:"Authorization,optional"`
	// Body          string `json:"body,optional"`
}

func main() {
	req := Request{
		// Node:          "foo",
		// ID:            1024,
		ContentType:   "application/x-www-form-urlencoded",
		Authorization: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
		// Body:          "hello, world",
	}
	resp, err := httpc.Do(context.Background(), http.MethodPost, "http://www.baidu.com", req)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(resp.StatusCode)
	io.Copy(os.Stdout, resp.Body)
	// io.Copy(os.Stdout, resp.Body)
}
